package com.example.personnel_oa.controller;
//Controler负责请求转发，接受页面过来的参数，传给Service处理，接到返回值，再传给页面。

import com.example.comment_oa.pojos.Mobility;
import com.example.comment_oa.pojos.Positive;
import com.example.comment_oa.response.AjaxResponse;
import com.example.personnel_oa.service.MobilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
//控制器类
@CrossOrigin
//禁止Ajax访问当前站点外的资源
@Controller
//控制器
@RequestMapping("/personnelOa")
//跨域处理请求
public class MobilityController {
    @Autowired
            //注解
    MobilityService mobilityService;
    @GetMapping("/Mobility/allmob")
    //用于处理请求的get类型
    public AjaxResponse Methods_mob(){

        return AjaxResponse.success(mobilityService.Methods_mob());
    }
    @PostMapping("Mobility/addmob")
    //用于处理请求的post类型
    public AjaxResponse addmob(@RequestBody Mobility mobility){
        int b = mobilityService.addmob(mobility);
        return AjaxResponse.success(b);
    }
}
